python if else hackerrank solution in python